Skip to content

Bump rust-lightning to include trampoline changes#825

Open
carlaKC wants to merge 1 commit intolightningdevkit:mainfrom
carlaKC:trampoline-deps
Open

Bump rust-lightning to include trampoline changes#825
carlaKC wants to merge 1 commit intolightningdevkit:mainfrom
carlaKC:trampoline-deps

Conversation

@carlaKC
Copy link

@carlaKC carlaKC commented Mar 13, 2026

Depends on #824.

Also needs the following patch on top of 2026-02-ldk-node-base in bitcoin-payment-instructions.

diff --git a/Cargo.toml b/Cargo.toml
index de128db..811cd36 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,8 +21,8 @@ default = ["std"]
 [dependencies]
 #lightning-invoice = { version = "0.34", default-features = false }
 #lightning = { version = "0.2.0", default-features = false, features = ["dnssec"] }
-lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", default-features = false }
-lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", default-features = false, features = ["dnssec"] }
+lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", default-features = false }
+lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", default-features = false, features = ["dnssec"] }
 bitcoin = { version = "0.32", default-features = false }
 getrandom = { version = "0.3", default-features = false, optional = true }
 dnssec-prover = { version = "0.6", default-features = false, optional = true, features = ["validation", "std", "tokio"] }
@@ -34,5 +34,5 @@ serde_json = { version = "1.0", default-features = false, optional = true, featu
 tokio = { version = "1.0", default-features = false, features = ["rt", "macros"] }
 #lightning = { version = "0.2.0", features = ["std"] }
 #lightning-net-tokio = { version = "0.2.0", default-features = false }
-lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", features = ["std"] }
-lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", default-features = false }
+lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", features = ["std"] }
+lightning-net-tokio = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "128ead25e8d62b0262b71711631220983c48756a", default-features = false }```

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Mar 13, 2026

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

src/event.rs Outdated
/// A set of multiple htlcs all associated with same forward.
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
pub struct HTLCSet(Vec<HTLCLocator>);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interested in some feedback here 🙏

To use default_value to fill in legacy fields when the new field isn't present, we need to implement Readable/Writeable for Vec<HTLCLocator>. We can't do this because we don't own the trait or the type (orphan rule).

The solution I've gone with here is to use a wrapper struct and pull in the code we have in impl_for_vec in LDK.

Alternatives would be:

  • Don't use default_value, and write manual Readable/Writeable impls for Event so that we can manually fill the legacy values (I can't find a way to do it within macros).
  • Just use required_vec and don't fill legacy values (seems bad).

src/event.rs Outdated
Comment on lines +379 to +380
// For backwards compatibility, write the first prev/next_htlc to our legacy fields. This
// allows use to downgrade with some information loss about the remaining htlcs.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the project's philosophy is for backwards compatibility, so just gone with what I would have done in LDK - happy to do something else if it's preferred!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, while we def. want to get to support downgrades at some point, we currently don't. So we can just drop this extra logic as long as we're positive backwards compatibility during upgrades is ensured.

@carlaKC carlaKC force-pushed the trampoline-deps branch 2 times, most recently from 76e3d44 to dd42f5f Compare March 13, 2026 17:56
Cargo.toml Outdated
Comment on lines +82 to +83
# TODO: need to push branch to Jeff's fork?
bitcoin-payment-instructions = { git = "https://github.com/carlaKC/bitcoin-payment-instructions", rev = "c22c9b836b70d4c915dd28701e11083a8b558d56" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tnull had been doing most of the updates until recently when my PRs (and others) started breaking LDK Node. I ended up setting up a remote to his branch and based mine off of it. Personally, I'd be fine if you want to do something similar, as that at least gives us a common history for bitcoin-payment-instructions bumps.

Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! Needs a rebase by now as #824 was merged.

Cargo.toml Outdated
#lightning-transaction-sync = { path = "../rust-lightning/lightning-transaction-sync" }
#lightning-liquidity = { path = "../rust-lightning/lightning-liquidity" }
#lightning-macros = { path = "../rust-lightning/lightning-macros" }
lightning-macros = { path = "../rust-lightning/lightning-macros" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This seems unrelated.

pub node_id: Option<PublicKey>,
}

impl_writeable_tlv_based!(HTLCLocator, {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'd really like to avoid duplicating upstream's serialization logic, which always risks to get out-of-sync. Can we rather also impl From<Vec<HTLCLocator>> for Vec<LdkHTLCLocator> and use upstream's write? I admit that is also not great, but maybe preferable to duplicating even more logic?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit that is also not great, but maybe preferable to duplicating even more logic?

Given this a shot, it's a little unwieldy but I agree probably preferable to duplication.

src/event.rs Outdated

/// A set of multiple htlcs all associated with same forward.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct HTLCSet(pub Vec<HTLCLocator>);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this additional newtype? I think even for bindings we should be able to leave it as Vec<HTLCLocator>?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was to get around the orphan rule for serialization (we can't implement a trait we don't own - Readable/Writeable - for a type we don't own - Vec<T>).

If we don't need backwards compat, then we don't need default_value and can clean up a whole bunch of things including this 👌

src/event.rs Outdated
(5, node_id, option),
});

impl From<lightning::events::HTLCLocator> for HTLCLocator {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Please import the upstream type as LdkHTLCLocator, which is the usual pattern.

src/event.rs Outdated
Comment on lines +379 to +380
// For backwards compatibility, write the first prev/next_htlc to our legacy fields. This
// allows use to downgrade with some information loss about the remaining htlcs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, while we def. want to get to support downgrades at some point, we currently don't. So we can just drop this extra logic as long as we're positive backwards compatibility during upgrades is ensured.

@carlaKC carlaKC marked this pull request as ready for review March 19, 2026 19:21
@carlaKC carlaKC requested a review from tnull March 19, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants